import Index from '../layout/Index.vue'
import shouye from '../views/shouye/'

/* 抽离路由将主路由抽离出来 */
export const asyncRoute = {
  path: '/',
  name: 'Index',
  component: Index,
  redirect: '/shouye',
  children: [
    /* 后台首页 */
    {
      path: '/shouye',
      meta: { name: '后台首页', icon: 'icon-shouye' },
      component: shouye
    },

    /* 订单管理 */
    {
      path: '/dingdan',
      meta: {
        name: '订单管理',
        role: ['super', 'normal'],
        icon: 'icon-icon-'
      },
      redirect: '/dingdan/list',
      component: () =>
        import(/* webpackChunkName:'dingdan' */ '../views/dingdan'),
      children: [
        {
          path: '/dingdan/list',
          meta: { name: '订单列表' },
          component: () =>
            import(
              /* webpackChunkName:'shangping/add' */ '../views/dingdan/list.vue'
            )
        },
        {
          name: 'orderEdit',
          path: '/dingdan/edit/:id',
          meta: { name: '订单编辑', role: ['super'] },
          //  hidden代表隐藏
          hidden: true,
          component: () =>
            import(
              /* webpackChunkName:'shangping/add' */ '../views/dingdan/edit.vue'
            )
        }
      ]
    },
    /* 商品管理 */
    {
      path: '/shangping',
      meta: { name: '商品管理', icon: 'icon-shangpin' },
      component: () =>
        import(/* webpackChunkName:'shangping' */ '../views/shangping'),

      children: [
        {
          path: '/shangping/list',
          meta: { name: '商品列表' },
          component: () =>
            import(
              /* webpackChunkName:'shangping/list' */ '../views/shangping/list.vue'
            )
        },
        {
          path: '/shangping/add',
          meta: { name: '商品添加' },
          component: () =>
            import(
              /* webpackChunkName:'shangping/add' */ '../views/shangping/add.vue'
            )
        },
        {
          path: '/shangping/classify',
          meta: { name: '商品分类' },
          component: () =>
            import(
              /* webpackChunkName:'shangping/classify' */ '../views/shangping/classify.vue'
            )
        }
      ]
    },
    /* 店铺管理 */
    {
      path: '/dianfu',
      meta: { name: '店铺管理', role: ['super'], icon: 'icon-dianpu' },
      component: () =>
        import(/* webpackChunkName:'/dianfu' */ '../views/dianfu')
    },
    /* 账号管理 */
    {
      path: '/zhanghao',
      meta: {
        name: '账号管理',
        role: ['super', 'normal'],
        icon: 'icon-zhanghao'
      },
      component: () =>
        import(/* webpackChunkName:'/zhanghao' */ '../views/zhanghao'),
      children: [
        {
          path: '/zhanghao/list',
          meta: { name: '账号列表', role: ['super'] },
          component: () =>
            import(
              /* webpackChunkName:'/zhanghao/list' */ '../views/zhanghao/list.vue'
            )
        },
        {
          path: '/zhanghao/add',
          meta: { name: '账号添加', role: ['super'] },
          component: () =>
            import(
              /* webpackChunkName:'/zhanghao/add' */ '../views/zhanghao/add.vue'
            )
        },
        {
          path: '/zhanghao/amend',
          meta: { name: '账号未知' },
          component: () =>
            import(
              /* webpackChunkName:'/zhanghao/amend' */ '../views/zhanghao/amend.vue'
            )
        },
        {
          path: '/zhanghao/geren',
          meta: { name: '账号个人' },
          //  hidden代表隐藏
          hidden: true,
          component: () =>
            import(
              /* webpackChunkName:'/zhanghao/amend' */ '../views/zhanghao/geren.vue'
            )
        }
      ]
    },
    /* 销售统计 */
    {
      path: '/xiaoshou',
      meta: { name: '销售统计', role: ['super'], icon: 'icon-tongji' },
      component: () =>
        import(/* webpackChunkName:'/xiaoshou' */ '../views/xiaoshou'),
      children: [
        {
          path: '/xiaoshou/statisticsone',
          meta: { name: '商品统计' },
          component: () =>
            import(
              /* webpackChunkName:'/statisticsone' */ '../views/xiaoshou/statisticsone.vue'
            )
        },
        {
          path: '/xiaoshou/statisticstwo',
          meta: { name: '订单统计' },
          component: () =>
            import(
              /* webpackChunkName:'/statisticstwo' */ '../views/xiaoshou/statisticstwo.vue'
            )
        }
      ]
    }
  ]
}
